package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (用户代理商申请单)TB_UserAgentRequestOrder
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_UserAgentRequestOrder#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_userAgentRequestOrder")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("用户代理商申请单")
@com.lianjing.sh.processing.info.annotation.InfoComment("用户代理商申请单")
public class TB_UserAgentRequestOrder
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	com.sh_lianjing.state.HasStatable,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 编号 */
		public String getNumber();
		/** 状态 */
		public bairui.international.model.status.State_UserAgentRequestOrder getState();
		/** 提交时间 */
		public java.util.Date getSubmitDate();
		/** 用户 */
		public bairui.international.model.domain.jpa.TB_User getUser();
		/** 姓名 */
		public String getName();
		/** 电话 */
		public String getPhone();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_UserAgentRequestOrder properties(MustProperties properties) {
		this.setNumber(properties.getNumber());
		this.setState(properties.getState());
		this.setSubmitDate(properties.getSubmitDate());
		this.setUser(properties.getUser());
		this.setName(properties.getName());
		this.setPhone(properties.getPhone());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_UserAgentRequestOrder(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 审核人员 */
		public bairui.international.model.domain.jpa.TB_Admin getVerifior();
		/** 审核时间 */
		public java.util.Date getVerifyDate();
		/** 昵称 */
		public String getNickName();
		/** 公司 */
		public String getCompany();
		/** 地址 */
		public String getAddress();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_UserAgentRequestOrder properties(OptionalSingleProperties properties) {
		this.setVerifior(properties.getVerifior());
		this.setVerifyDate(properties.getVerifyDate());
		this.setNickName(properties.getNickName());
		this.setCompany(properties.getCompany());
		this.setAddress(properties.getAddress());
		return this;
	}
	
	
	
	public TB_UserAgentRequestOrder(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 编号 */
		public String getNumber();
		/** 状态 */
		public bairui.international.model.status.State_UserAgentRequestOrder getState();
		/** 提交时间 */
		public java.util.Date getSubmitDate();
		/** 用户 */
		public bairui.international.model.domain.jpa.TB_User getUser();
		/** 姓名 */
		public String getName();
		/** 电话 */
		public String getPhone();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_UserAgentRequestOrder properties(CurrentMustProperties properties) {
		this.setNumber(properties.getNumber());
		this.setState(properties.getState());
		this.setSubmitDate(properties.getSubmitDate());
		this.setUser(properties.getUser());
		this.setName(properties.getName());
		this.setPhone(properties.getPhone());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 审核人员 */
		public bairui.international.model.domain.jpa.TB_Admin getVerifior();
		/** 审核时间 */
		public java.util.Date getVerifyDate();
		/** 昵称 */
		public String getNickName();
		/** 公司 */
		public String getCompany();
		/** 地址 */
		public String getAddress();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_UserAgentRequestOrder properties(CurrentOptionalSingleProperties properties) {
		this.setVerifior(properties.getVerifior());
		this.setVerifyDate(properties.getVerifyDate());
		this.setNickName(properties.getNickName());
		this.setCompany(properties.getCompany());
		this.setAddress(properties.getAddress());
		return this;
	}
	
	public TB_UserAgentRequestOrder(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_UserAgentRequestOrder(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_UserAgentRequestOrder update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_UserAgentRequestOrder.this);
			if(isOverride_getOrderValue){
				TB_UserAgentRequestOrder.this.setOrderValue(orderValue);
			}
	
			String number = getNumber(TB_UserAgentRequestOrder.this);
			if(isOverride_getNumber){
				TB_UserAgentRequestOrder.this.setNumber(number);
			}
	
			bairui.international.model.status.State_UserAgentRequestOrder state = getState(TB_UserAgentRequestOrder.this);
			if(isOverride_getState){
				TB_UserAgentRequestOrder.this.setState(state);
			}
	
			java.util.Date submitDate = getSubmitDate(TB_UserAgentRequestOrder.this);
			if(isOverride_getSubmitDate){
				TB_UserAgentRequestOrder.this.setSubmitDate(submitDate);
			}
	
			bairui.international.model.domain.jpa.TB_User user = getUser(TB_UserAgentRequestOrder.this);
			if(isOverride_getUser){
				TB_UserAgentRequestOrder.this.setUser(user);
			}
	
			java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord> userAgentRequestOrderRecords = getUserAgentRequestOrderRecords(TB_UserAgentRequestOrder.this);
			if(isOverride_getUserAgentRequestOrderRecords){
				TB_UserAgentRequestOrder.this.setUserAgentRequestOrderRecords(userAgentRequestOrderRecords);
			}
	
			bairui.international.model.domain.jpa.TB_Admin verifior = getVerifior(TB_UserAgentRequestOrder.this);
			if(isOverride_getVerifior){
				TB_UserAgentRequestOrder.this.setVerifior(verifior);
			}
	
			java.util.Date verifyDate = getVerifyDate(TB_UserAgentRequestOrder.this);
			if(isOverride_getVerifyDate){
				TB_UserAgentRequestOrder.this.setVerifyDate(verifyDate);
			}
	
			String nickName = getNickName(TB_UserAgentRequestOrder.this);
			if(isOverride_getNickName){
				TB_UserAgentRequestOrder.this.setNickName(nickName);
			}
	
			String name = getName(TB_UserAgentRequestOrder.this);
			if(isOverride_getName){
				TB_UserAgentRequestOrder.this.setName(name);
			}
	
			String phone = getPhone(TB_UserAgentRequestOrder.this);
			if(isOverride_getPhone){
				TB_UserAgentRequestOrder.this.setPhone(phone);
			}
	
			String company = getCompany(TB_UserAgentRequestOrder.this);
			if(isOverride_getCompany){
				TB_UserAgentRequestOrder.this.setCompany(company);
			}
	
			String address = getAddress(TB_UserAgentRequestOrder.this);
			if(isOverride_getAddress){
				TB_UserAgentRequestOrder.this.setAddress(address);
			}
		}
	
		public TB_UserAgentRequestOrder up(){
			return TB_UserAgentRequestOrder.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 编号 */
		private boolean isOverride_getNumber = true;
		public String getNumber(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getNumber = false; 
			return null;
		}
		/** 状态 */
		private boolean isOverride_getState = true;
		public bairui.international.model.status.State_UserAgentRequestOrder getState(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getState = false; 
			return null;
		}
		/** 提交时间 */
		private boolean isOverride_getSubmitDate = true;
		public java.util.Date getSubmitDate(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getSubmitDate = false; 
			return null;
		}
		/** 用户 */
		private boolean isOverride_getUser = true;
		public bairui.international.model.domain.jpa.TB_User getUser(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getUser = false; 
			return null;
		}
		/** 用户代理商申请记录 */
		private boolean isOverride_getUserAgentRequestOrderRecords = true;
		public java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord> getUserAgentRequestOrderRecords(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getUserAgentRequestOrderRecords = false; 
			return null;
		}
		/** 审核人员 */
		private boolean isOverride_getVerifior = true;
		public bairui.international.model.domain.jpa.TB_Admin getVerifior(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getVerifior = false; 
			return null;
		}
		/** 审核时间 */
		private boolean isOverride_getVerifyDate = true;
		public java.util.Date getVerifyDate(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getVerifyDate = false; 
			return null;
		}
		/** 昵称 */
		private boolean isOverride_getNickName = true;
		public String getNickName(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getNickName = false; 
			return null;
		}
		/** 姓名 */
		private boolean isOverride_getName = true;
		public String getName(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getName = false; 
			return null;
		}
		/** 电话 */
		private boolean isOverride_getPhone = true;
		public String getPhone(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getPhone = false; 
			return null;
		}
		/** 公司 */
		private boolean isOverride_getCompany = true;
		public String getCompany(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getCompany = false; 
			return null;
		}
		/** 地址 */
		private boolean isOverride_getAddress = true;
		public String getAddress(TB_UserAgentRequestOrder it) throws Exception { 
			isOverride_getAddress = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_UserAgentRequestOrder() {
	}
	
	public TB_UserAgentRequestOrder(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_UserAgentRequestOrder(
		@lombok.NonNull TB_UserAgentRequestOrder bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setNumber(bean.getNumber());
		this.setState(bean.getState());
		this.setSubmitDate(bean.getSubmitDate());
		this.setUser(bean.getUser());
		this.setUserAgentRequestOrderRecords(bean.getUserAgentRequestOrderRecords());
		this.setVerifior(bean.getVerifior());
		this.setVerifyDate(bean.getVerifyDate());
		this.setNickName(bean.getNickName());
		this.setName(bean.getName());
		this.setPhone(bean.getPhone());
		this.setCompany(bean.getCompany());
		this.setAddress(bean.getAddress());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("编号")
	@com.lianjing.sh.processing.info.annotation.InfoComment("编号")
	@javax.persistence.Column(name="number", unique=true, nullable=false, length=32)
	private String number;

	@com.lianjing.sh.model.common.annotation.Comment("状态")
	@com.lianjing.sh.processing.info.annotation.InfoComment("状态")
	@javax.persistence.Enumerated(javax.persistence.EnumType.STRING)
	@javax.persistence.Column(name="state", nullable=false)
	private bairui.international.model.status.State_UserAgentRequestOrder state;

	@com.lianjing.sh.model.common.annotation.Comment("提交时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("提交时间")
	@javax.persistence.Column(name="submitDate", nullable=false)
	private java.util.Date submitDate;

	@com.lianjing.sh.model.common.annotation.Comment("用户")
	@com.lianjing.sh.processing.info.annotation.InfoComment("用户")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_User user;

	@com.lianjing.sh.model.common.annotation.Comment("用户代理商申请记录")
	@com.lianjing.sh.processing.info.annotation.InfoComment("用户代理商申请记录")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToMany(mappedBy="userAgentRequestOrder")
	private java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord> userAgentRequestOrderRecords;

	@com.lianjing.sh.model.common.annotation.Comment("审核人员")
	@com.lianjing.sh.processing.info.annotation.InfoComment("审核人员")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne()
	private bairui.international.model.domain.jpa.TB_Admin verifior;

	@com.lianjing.sh.model.common.annotation.Comment("审核时间")
	@com.lianjing.sh.processing.info.annotation.InfoComment("审核时间")
	@javax.persistence.Column(name="verifyDate")
	private java.util.Date verifyDate;

	@com.lianjing.sh.model.common.annotation.Comment("昵称")
	@com.lianjing.sh.processing.info.annotation.InfoComment("昵称")
	@javax.persistence.Column(name="nickName", length=255)
	private String nickName;

	@com.lianjing.sh.model.common.annotation.Comment("姓名")
	@com.lianjing.sh.processing.info.annotation.InfoComment("姓名")
	@javax.persistence.Column(name="name", nullable=false, length=30)
	private String name;

	@com.lianjing.sh.model.common.annotation.Comment("电话")
	@com.lianjing.sh.processing.info.annotation.InfoComment("电话")
	@javax.persistence.Column(name="phone", nullable=false)
	private String phone;

	@com.lianjing.sh.model.common.annotation.Comment("公司")
	@com.lianjing.sh.processing.info.annotation.InfoComment("公司")
	@javax.persistence.Column(name="company")
	private String company;

	@com.lianjing.sh.model.common.annotation.Comment("地址")
	@com.lianjing.sh.processing.info.annotation.InfoComment("地址")
	@javax.persistence.Column(name="address")
	private String address;

	/** get[编号] */
	public String getNumber() {
		return this.number;
	}

	/** get[状态] */
	public bairui.international.model.status.State_UserAgentRequestOrder getState() {
		return this.state;
	}

	/** get[提交时间] */
	public java.util.Date getSubmitDate() {
		return this.submitDate;
	}

	/** get[用户] */
	public bairui.international.model.domain.jpa.TB_User getUser() {
		return this.user;
	}

	/** get[用户代理商申请记录] */
	public java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord> getUserAgentRequestOrderRecords() {
		return this.userAgentRequestOrderRecords;
	}

	/** get[审核人员] */
	public bairui.international.model.domain.jpa.TB_Admin getVerifior() {
		return this.verifior;
	}

	/** get[审核时间] */
	public java.util.Date getVerifyDate() {
		return this.verifyDate;
	}

	/** get[昵称] */
	public String getNickName() {
		return this.nickName;
	}

	/** get[姓名] */
	public String getName() {
		return this.name;
	}

	/** get[电话] */
	public String getPhone() {
		return this.phone;
	}

	/** get[公司] */
	public String getCompany() {
		return this.company;
	}

	/** get[地址] */
	public String getAddress() {
		return this.address;
	}

	/** set[编号] */
	public void setNumber(String number) {
		this.number = number;
	}

	/** set[状态] */
	public void setState(bairui.international.model.status.State_UserAgentRequestOrder state) {
		this.state = state;
	}

	/** set[提交时间] */
	public void setSubmitDate(java.util.Date submitDate) {
		this.submitDate = submitDate;
	}

	/** set[用户] */
	public void setUser(bairui.international.model.domain.jpa.TB_User user) {
		this.user = user;
	}

	/** set[用户代理商申请记录] */
	public void setUserAgentRequestOrderRecords(java.util.List<bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord> userAgentRequestOrderRecords) {
		this.userAgentRequestOrderRecords = userAgentRequestOrderRecords;
	}

	/** set[审核人员] */
	public void setVerifior(bairui.international.model.domain.jpa.TB_Admin verifior) {
		this.verifior = verifior;
	}

	/** set[审核时间] */
	public void setVerifyDate(java.util.Date verifyDate) {
		this.verifyDate = verifyDate;
	}

	/** set[昵称] */
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	/** set[姓名] */
	public void setName(String name) {
		this.name = name;
	}

	/** set[电话] */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/** set[公司] */
	public void setCompany(String company) {
		this.company = company;
	}

	/** set[地址] */
	public void setAddress(String address) {
		this.address = address;
	}

	public void assignUser(bairui.international.model.domain.jpa.TB_User user) {
		if(null != user){
			user.addUserAgentRequestOrders(this);
		}
		this.setUser(user);
	}
	



	/** add[UserAgentRequestOrderRecords] */
	public TB_UserAgentRequestOrder addUserAgentRequestOrderRecords(bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord ... userAgentRequestOrderRecords){
		if(this.userAgentRequestOrderRecords == null){
			this.userAgentRequestOrderRecords = new java.util.ArrayList<>();
		}
		for(bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord bean : userAgentRequestOrderRecords){
			bean.setUserAgentRequestOrder(this);
			this.userAgentRequestOrderRecords.add(bean);
		}
		return this;
	}
	
	/** remove[UserAgentRequestOrderRecords] */
	public TB_UserAgentRequestOrder removeUserAgentRequestOrderRecords(bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord ... userAgentRequestOrderRecords){
		if(this.userAgentRequestOrderRecords == null){
			return this;
		}
		for(bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord bean : userAgentRequestOrderRecords){
			bean.setUserAgentRequestOrder(null);
			this.userAgentRequestOrderRecords.remove(bean);
		}
		return this;
	}
	
	/**
	 * contains[UserAgentRequestOrderRecords]
	 *
	 * 全部输入都包含：返回 true
	 * 输入中有至少有一个不包含：返回 false
	 */
	public boolean containsUserAgentRequestOrderRecords(bairui.international.model.domain.jpa.TB_UserAgentRequestOrderRecord ... userAgentRequestOrderRecords){
		if(this.userAgentRequestOrderRecords == null || userAgentRequestOrderRecords==null || userAgentRequestOrderRecords.length<=0){
			return false;
		}
		return this.userAgentRequestOrderRecords.containsAll(java.util.Arrays.asList(userAgentRequestOrderRecords));
	}
	

	/** take[用户] */
	public bairui.international.model.domain.jpa.TB_User takeUser(){
		if(null == this.user){
			this.user = new bairui.international.model.domain.jpa.TB_User();
		}
		return this.user;
	}
	
	/** take[审核人员] */
	public bairui.international.model.domain.jpa.TB_Admin takeVerifior(){
		if(null == this.verifior){
			this.verifior = new bairui.international.model.domain.jpa.TB_Admin();
		}
		return this.verifior;
	}
	
	/** must[用户] */
	public bairui.international.model.domain.jpa.TB_User mustUser() {
		return this.user;
	}
	
	/** optional[审核人员] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_Admin> optionalVerifior() {
		return java.util.Optional.ofNullable(this.verifior);
	}
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_UserAgentRequestOrder other = (TB_UserAgentRequestOrder) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		String name = this.getName();
		if(null != name){
			return String.valueOf(name);
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}

	/**
	 * 状态相关
	 */
	public bairui.international.model.status.State_UserAgentRequestOrder state(){
		return this.getState();
	}


}
